package com.jp.knowledge.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;

/**
 * Created by 528787067@qq.com on 2017/4/5.
 */

public class HomePageRecyclerView extends RecyclerView {
    public HomePageRecyclerView(Context context) {
        super(context);
    }

    public HomePageRecyclerView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public HomePageRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean fling(int velocityX, int velocityY) {
        return super.fling(velocityX, canFling ? velocityY : 0);
    }

    private boolean canFling = true;
    public void setCanFling(boolean canFling){
        this.canFling = canFling;
    }
}
